---
title: Maintain diagnoses, procedures and service lines
summary: A user creates, updates and deletes diagnoses, procedures and service lines on a bill, with code validation and a running services total.
status: draft
owner: Claims
last_reviewed: 2026-09-30
operation_id: maintain-bill-lines
trigger: User edits diagnoses, procedures or service lines in the Bill entry grids
---

# Maintain diagnoses, procedures and service lines

A user creates, updates and deletes diagnoses, procedures and service lines on a bill, with code validation and a running services total.

## Trigger and screens

| Item | Detail |
| --- | --- |
| Trigger | User edits diagnoses, procedures or service lines in the Bill entry grids |
| Screens | [Bill entry](../../screens/entry.md) |
| Tables | Not traced** |

## Steps

1. Each grid reads its rows: [DiagnosisGrid.EditingCustom_Read](../hosted-endpoints.md#diagnosisgrid.editingcustom_read), [ProcedureGrid.EditingCustom_Read](../hosted-endpoints.md#proceduregrid.editingcustom_read) and [ServiceGrid.EditingPopup_Read](../hosted-endpoints.md#servicegrid.editingpopup_read). Procedure types are mapped to Principal or Other ([BR-SCR-010](../business-rules.md#br-scr-010-procedure-type-maps-to-principal-or-other)).
   - The reads call `IBillDiagnosisService.GetDiagnoses`, `IBillProcedureService.GetProcedures` and `IBillServiceService.GetServices`.
2. When the user keys a code, the screen validates it through [DiagnosisGrid.ValidateDiagnosisCode](../hosted-endpoints.md#diagnosisgrid.validatediagnosiscode), [ProcedureGrid.ValidateProcedureCode](../hosted-endpoints.md#proceduregrid.validateprocedurecode) or [ServiceGrid.ValidateServiceCode](../hosted-endpoints.md#servicegrid.validateservicecode).
   - The validations call `IDiagnosisService.GetDiagnosis`, `IProcedureService.GetProcedure` and `IBillServiceService.GetServiceTypeCode`.
3. Create, update and delete use the `EditingCustom_*` and `EditingPopup_*` actions of each grid, for example [ServiceGrid.EditingPopup_Create](../hosted-endpoints.md#servicegrid.editingpopup_create). Each action calls the Create, Update or Delete method of the matching bill service, and errors are returned through `ModelStateWrapper`.
4. The Add service and Edit service windows use the prescribing provider dropdown from [ServiceGrid.GetPrescribingProviderCodes](../hosted-endpoints.md#servicegrid.getprescribingprovidercodes).
5. After each service change the screen refreshes Services Total from [ServiceGrid.GetChargedServicesTotal](../hosted-endpoints.md#servicegrid.getchargedservicestotal); the value feeds the submit comparison ([BR-SCR-004](../business-rules.md#br-scr-004-total-mismatch-requires-confirmation)).
6. The Clear actions, [DiagnosisGrid.ClearDiagnosesCodes](../hosted-endpoints.md#diagnosisgrid.cleardiagnosescodes) and [ProcedureGrid.ClearProcedureCodes](../hosted-endpoints.md#proceduregrid.clearprocedurecodes), remove all rows through GET requests.

   > **Origin**: The reads, validations, changes and total in steps 1–5 are the controller-side calls to `IBillDiagnosisService`, `IBillProcedureService`, `IBillServiceService`, `IDiagnosisService` and `IProcedureService` in `SAIF.SAIFCode.Core`†. Per the Legends CLI RAG service, `SAIF.SAIFCode.Core` is a contracts-only library and these interfaces' implementations live outside it (most likely `SAIF.Services`), which this run did not trace*.

## Process flow

The diagram shows the main path and its decision points.

```mermaid
flowchart TD
    A["Grid read"] --> B["User adds or edits a row"]
    B --> C["Validate code"]
    C --> D{"Code valid?"}
    D -->|"No"| X["Show validation message"]
    D -->|"Yes"| E["Create or update action"]
    E --> F{"Model errors?"}
    F -->|"Yes"| X
    F -->|"No"| G["Refresh grid and<br>charged services total"]
```

## Failure and edge-case behavior

- Invalid codes and model errors are returned to the grid and the row is not saved.
- These endpoints require only an authenticated user and have no role check; see [Tech debt](../tech-debt.md).
- Clear deletes data through GET.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Hosted endpoints](../hosted-endpoints.md)
- [Data model](../data-model.md)
- [Architecture](../architecture.md)
- [Tech debt](../tech-debt.md)
- [Screen catalog](../../screens/index.md)

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. Statements marked with `*` were inferred
> from code structure or contextual evidence. Statements marked with `**` could
> not be confirmed; treat as unknown until verified.

## Sources
- ClaimBillEntry/Controllers/DiagnosisGridController.cs
- ClaimBillEntry/Controllers/ProcedureGridController.cs
- ClaimBillEntry/Controllers/ServiceGridController.cs
- ClaimBillEntry/Classes/AutoMapperBootStrapper.cs